{extend name="public/base"/}
{block name="body"}
<div class="main-box no-header clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}（{$count}）</h2>
		</div>
		<div class="pull-right">
			<!-- <a href="{:url('add')}" class="btn btn-primary pull-right"> <i class="fa fa-plus-circle fa-lg"></i> 新增</a> -->
		</div>
	</header>
	<div class="main-box-body clearfix">
		<div class="table-responsive">
      <table class="table table-striped table-hover">
        <thead>
          <tr>
            <th width="30"><input class="checkbox check-all" type="checkbox"></th>
            <th width="60">ID</th>
            <th>用户名</th>
            <th>金额</th>
            <th>状态</th>
            <th>送货方式</th>
						<th>支付方式</th>
            <th>地址</th>
            <th>送货时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          {volist name="list" id="item"}
          <tr>
            <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
            <td>{$item['id']}</td>

            <td>{$item['user_name']} </td>
            <td>{$item['total']} </td>
            <td>{$item['buystatus']|parse_config_value='pay_status'}</td>
						<td>{$item['way']|parse_config_value='distribution'}</td>
						<td>{$item['pay']|parse_config_value='pay'}</td>
						<td>{$item['address']}</td>
						<td>{$item['deliverytime']}</td>

            <td>
							<a href="{:url('edit',array('id'=>$item['id']))}">编辑</a>

							  <!-- <a url="{:url('express',array('id'=>$item['id']))}" href="javascript:;"  data-toggle="modal" data-target="#myModal3" data-id="{$item['id']}">快递</a> -->
							{eq name="$item.way" value = '1'}
								<a href="{:url('shipments',array('id'=>$item['id'],'note'=>1))}" class="confirm ajax-get">发货</a>
								<a href="{:url('shipments',array('id'=>$item['id'],'note'=>0))}" class="confirm ajax-get">发货(不发短信给用户)</a>
							{/eq}
							{eq name="$item.way" value = '2'}
								<a href="{:url('taketheir',array('id'=>$item['id']))}" class="confirm ajax-get">自提</a>
							{/eq}
							{eq name="$item.way" value = '3'}
								<a href="javascript:;"  data-toggle="modal" data-target="#myModal3" data-id="{$item['id']}">邮寄信息</a>
							{/eq}
							<a href="javascript:;" data-toggle="modal" data-target="#myModal2" data-id="{$item['id']}" >补退</a>
							<!-- <a href="{:url('revokeOrder',array('id'=>$item['id']))}" class="confirm ajax-get">撤单</a> -->

            </td>
          </tr>
          {/volist}
        </tbody>
      </table>
		{$list->render()}

			<!-- Modal -->
      <div class="modal fade "  id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <h4 class="modal-title" id="myModalLabel">分配师傅</h4>
            </div>
						<form class="form-horizontal" action="{:url('allot')}" method="post">
	            <div class="modal-body">
								{volist name=":getDeliveryPerson()" id="vo"}
									<label class="radio-inline">
									  <input type="radio" name="allot_person"  value="{$vo.id}"> {$vo.name}
									</label>
								{/volist}
								<input type="hidden" name="id" value="">
	            </div>
	            <div class="modal-footer">
	              <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	              <button type="submit" class="btn btn-primary submit-btn ajax-post"  target-form="form-horizontal">分配</button>
	            </div>
						</form>
          </div>
        </div>
      </div>
			<script>
			 $(function(){
				 $('#myModal').on('show.bs.modal', function (e) {
						var id = $(e.relatedTarget.outerHTML).attr('data-id');
						$(e.target).find('[name="id"]').val(id);
				 })
			 })
			</script>

			<div class="modal fade "  id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-sm">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <h4 class="modal-title" id="myModalLabel">是否需要补退差价</h4>
            </div>
						<form class="form-horizontal2" action="{:url('returnBalance')}" method="post">
	            <div class="modal-body">
	              <div>补退金额：<input type="text" name="return_price" class="form-control" value="0" style=" width: 60px;text-align: center;" /></div>
								<div>
									<span>补退说明：</span>
									<textarea name="return_dec" class="form-control"></textarea>
								</div>
													<input type="hidden" name="id" value="">
	            </div>
	            <div class="modal-footer">
	              <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	              <button type="submit" class="btn btn-primary submit-btn ajax-post"  target-form="form-horizontal2">确定</button>
	            </div>
						</form>
          </div>
        </div>
      </div>
			<script>
			 $(function(){
				 $('#myModal2').on('show.bs.modal', function (e) {
						var id = $(e.relatedTarget.outerHTML).attr('data-id');
						$(e.target).find('[name="id"]').val(id);
				 })
			 })
			</script>

			<div class="modal fade "  id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
        <div class="modal-dialog ">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
              <h4 class="modal-title" id="myModalLabel3">填写快递信息</h4>
            </div>
						<form class="form-horizontal3" action="{:url('express')}" method="post">
	            <div class="modal-body">
	             	<!-- <p> 快递名称：<input type="text" name="express_text"  style=" " /> </p> -->
								<p>快递信息：<input type="text" name="express_no" value="" style="width:100%" /> </p>

													<input type="hidden" name="id" >
	            </div>
	            <div class="modal-footer">
	              <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	              <button type="submit" class="btn btn-primary submit-btn ajax-post"  target-form="form-horizontal3">确定</button>
	            </div>
						</form>
          </div>
        </div>
      </div>
			<script>
			 $(function(){
				 $('#myModal3').on('show.bs.modal', function (e) {
						var id = $(e.relatedTarget.outerHTML).attr('data-id');
						$(e.target).find('[name="id"]').val(id);
				 })
			 })
			</script>

		</div>
	</div>
</div>
{/block}
